import java.util.Scanner;

public class zifushu {
    public static void main(String[] args) {
        int count = 0;
        Scanner scanner = new Scanner(System.in);

        String line = scanner.nextLine().toLowerCase();
        byte[] bytes = line.getBytes();

        String s = scanner.nextLine().toLowerCase();
        byte[] sBytes = s.getBytes();


        for (int i = 0; i < bytes.length; i++) {
            if (sBytes[0]==bytes[i]){
                count++;
            }



        }
        System.out.println(count);

    }
}
